Class NotificationSDKClient
- java.lang.Object
-
- com.vasco.digipass.sdk.utils.notification.client.NotificationSDKClient
-
public class NotificationSDKClient extends java.lang.ObjectThis class provides the main functions of the Notification SDK Client.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceNotificationSDKClient.NotificationSDKClientListener
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringVERSIONVersion of the Notification SDK
-
Constructor Summary
Constructors Constructor Description NotificationSDKClient()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,java.lang.String>getCustomAttributes(android.content.Intent notification)Parses the notification provided as an Android Intent and returns the custom attributes as an HashMap.static booleanisForegroundNotification(android.content.Intent intent)Check if the provided intent is a foreground notification.static booleanisVASCONotification(android.content.Intent notification)Check if the provided intent is a valid VASCO notification.static java.lang.StringparseVASCONotification(android.content.Intent notification)Parses the notification provided as an Android Intent and returns the associated content as a String.static voidregisterNotificationService(android.content.Context context, NotificationSDKClient.NotificationSDKClientListener notificationSDKClientListener)Registers to the Firebase Cloud Messaging service.
-
-
-
Field Detail
-
VERSION
public static final java.lang.String VERSION
Version of the Notification SDK- See Also:
- Constant Field Values
-
-
Method Detail
-
registerNotificationService
public static void registerNotificationService(android.content.Context context, NotificationSDKClient.NotificationSDKClientListener notificationSDKClientListener)Registers to the Firebase Cloud Messaging service. This function should be called at every application start to update the identifier in the backend, if needed. Additionally, make sure that a onespan-notifications.properties file is present in the asset folder. This file must contain two key/value pairs:- notificationMIMEType: mime type that will be used when a notification is received. This must be the same value than the one specified inside the manifest.
- notificationIconName: icon displayed on the notification center when a notification is received. This icon must be added as a resource.
- Parameters:
context- The context of the application.notificationSDKClientListener- The Listener which return registrationIdentifier or error code.NotificationSDKClientErrorCodes.INTERNAL_ERRORif an internal error occurred.NotificationSDKClientErrorCodes.NETWORK_NOT_AVAILABLEif the network is not available.NotificationSDKClientErrorCodes.GOOGLEPLAYSERVICES_NOT_AVAILABLEif the Google Play Services are not available.NotificationSDKClientErrorCodes.CONTEXT_NULLif the context parameter is null.NotificationSDKClientErrorCodes.PROPERTIES_FILE_ERRORif there is an error with the properties file.NotificationSDKClientErrorCodes.FCM_GET_INSTANCE_ERRORif there is an error when FCM is not able to generate an instance.NotificationSDKClientErrorCodes.FCM_GENERATE_TOKEN_ERRORif there is an error when FCM is not able to generate a token.
-
parseVASCONotification
public static java.lang.String parseVASCONotification(android.content.Intent notification) throws NotificationSDKClientExceptionParses the notification provided as an Android Intent and returns the associated content as a String.- Parameters:
notification- The intent provided by the system.- Returns:
- the content of the message associated with the notification that has been parsed. Null if nothing to parse.
- Throws:
NotificationSDKClientException-NotificationSDKClientErrorCodes.NOTIFICATION_NULLif notification is Null.NotificationSDKClientErrorCodes.NOTIFICATION_INVALIDif notification is invalid.
-
getCustomAttributes
public static java.util.Map<java.lang.String,java.lang.String> getCustomAttributes(android.content.Intent notification) throws NotificationSDKClientExceptionParses the notification provided as an Android Intent and returns the custom attributes as an HashMap.- Parameters:
notification- The intent provided by the system.- Returns:
- the content of the message associated with the notification that has been parsed. Empty map if nothing to parse.
- Throws:
NotificationSDKClientException-NotificationSDKClientErrorCodes.NOTIFICATION_NULLif notification is Null.NotificationSDKClientErrorCodes.NOTIFICATION_INVALIDif notification is invalid.
-
isVASCONotification
public static boolean isVASCONotification(android.content.Intent notification) throws NotificationSDKClientExceptionCheck if the provided intent is a valid VASCO notification.- Parameters:
notification- The intent provided by the system.- Returns:
- true if the provided intent is a valid VASCO notification, false otherwise.
- Throws:
NotificationSDKClientException-NotificationSDKClientErrorCodes.INTERNAL_ERRORif an internal error occurred.
-
isForegroundNotification
public static boolean isForegroundNotification(android.content.Intent intent)
Check if the provided intent is a foreground notification. This is used only when enabling the 'notificationOpenInForeground' feature.- Parameters:
intent- The intent provided by the system.- Returns:
- true if the notification is received from the server while the app is in foreground. false otherwise,
-
-